package com.zyw.mvc.exception.handler;

import com.zyw.mvc.support.WrappedResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author vill on 15/12/18 15:40.
 * @desc 业务异常处理器
 */
public abstract class RestExceptionHandler {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 是否返回堆栈信息
     */
    protected boolean fullStack;

    /**
     * 是否需要返回堆栈信息
     *
     * @param fullStack 是否开启堆栈全部显示
     */
    protected RestExceptionHandler(boolean fullStack) {
        this.fullStack = fullStack;
    }

    protected boolean isFullStack() {
        return fullStack;
    }

    protected abstract boolean support(Exception e);

    protected abstract WrappedResult handleInvoke(Exception e);
}
